package com.wicket.okrbff.web.contorller;

import com.wicket.okrapp.common.ro.OkrResult;
import com.wicket.okrapp.dal.po.mbg.OmsDualHighFrameworkData;
import com.wicket.okrbff.biz.service.DualHighFrameworkDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * @author CHS
 * @since 2025-10-02
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/oms/dual/high/framework/data/")
public class DualHighFrameworkDataController {

    @Autowired
    DualHighFrameworkDataService service;

    /**
     * 新增-双高标准框架数据
     */
    @PostMapping("add")
    public OkrResult<String> add(@RequestBody @Validated OmsDualHighFrameworkData obj){
        return OkrResult.success(service.addDualHighFrameworkData(obj));
    }

    /**
     * 修改-双高标准框架数据
     */
    @PostMapping("update")
    public OkrResult<Boolean> update(@RequestBody @Validated OmsDualHighFrameworkData obj){
        return OkrResult.success(service.updateDualHighFrameworkData(obj));
    }

    /**
     * 删除-双高标准框架数据
     */
    @PostMapping("delete")
    public OkrResult<Boolean> delete(@RequestBody @Validated OmsDualHighFrameworkData obj){
        return OkrResult.success(service.deleteDualHighFrameworkData(obj.getDualHighId()));
    }

    /**
     * 列表-双高标准框架数据
     */
    @PostMapping("list")
    public OkrResult<ArrayList<OmsDualHighFrameworkData>> list(@RequestBody @Validated OmsDualHighFrameworkData obj){
        return OkrResult.success(new ArrayList<>(service.queryDualHighFrameworkDataList(obj)));
    }

    /**
     * 详情-双高标准框架数据
     */
    @PostMapping("detail")
    public OkrResult<OmsDualHighFrameworkData> detail(@RequestBody @Validated OmsDualHighFrameworkData obj){
        return OkrResult.success(service.queryDualHighFrameworkDataDetail(obj));
    }

}
